//
//  DestinationCollectionViewCell.m
//  LT
//
//  Created by dllo on 16/5/18.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "DestinationCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation DestinationCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
    
    
}

-(void)createSubViews{
    
    self.photoImage = [[UIImageView alloc]init];
    self.photoImage.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.photoImage];
    
    self.cnnameLabel = [[UILabel alloc]init];
    self.cnnameLabel.backgroundColor = [UIColor clearColor];//城市名字怎么赋值
    self.cnnameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.cnnameLabel];
    
    
    self.ennameLabel = [[UILabel alloc]init];
    self.ennameLabel.backgroundColor = [UIColor clearColor];//城市名字怎么赋值
   self.ennameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.ennameLabel];
    
    self.countLabel = [[UILabel alloc]init];
     self.countLabel.textColor = [UIColor whiteColor];
    self.countLabel.backgroundColor = [UIColor clearColor];
    self.countLabel.alpha = 0.5;
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.countLabel];
    
    self.labelLabel = [[UILabel alloc]init];
    self.labelLabel.textColor = [UIColor whiteColor];
    self.labelLabel.backgroundColor = [UIColor clearColor];
     self.labelLabel.alpha = 0.5;
    self.labelLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.labelLabel];
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.photoImage.frame = self.contentView.bounds;
     self.cnnameLabel.frame = CGRectMake(10 * WIDTHCELL, (self.contentView.frame.size.height - 80), 100* WIDTHCELL, 30* WIDTHCELL);
    self.ennameLabel.frame = CGRectMake(10* WIDTHCELL, (self.contentView.frame.size.height - 50), 100* WIDTHCELL, 30* WIDTHCELL);
    self.countLabel.frame = CGRectMake((self.contentView.frame.size.width - 60), 20* WIDTHCELL, 50* WIDTHCELL, 30* WIDTHCELL);
    self.labelLabel.frame = CGRectMake((self.contentView.frame.size.width - 60), 50* WIDTHCELL, 50* WIDTHCELL, 30* WIDTHCELL);
    
}

-(void)setDesHotModel:(DesHot_countryModel *)DesHotModel{
    _DesHotModel = DesHotModel;
    
    //自身的cnnameLabel的文字等于model中传过来的cnname;
    self.cnnameLabel.text = _DesHotModel.cnname;
    self.ennameLabel.text = _DesHotModel.enname;
    self.countLabel.text = [_DesHotModel.count stringValue];
    self.labelLabel.text = _DesHotModel.label;
    
//图片是网络请求下来的,所以格式特殊
     [self.photoImage sd_setImageWithURL:[NSURL URLWithString:_DesHotModel.photo] placeholderImage:[UIImage imageNamed:@"LETU"]];

}

@end
